@ECHO off
SET modules=root log all logmanager renderwindow camera scenemanager viewport ^
 framelistener vector3 colourvalue resourcegroupmanager entity scenenode configfile ^
 exception internals\exceptionhandling internals\iteration quaternion movableobject ^
 light windoweventutilities internals\event common plane meshmanager hardwarebuffer ^
 sharedptr mesh internals\utils ..\ogrebites\sdkcameraman math rendersystemcapabilities ^
 rendersystem ..\ois\prereqs ..\ois\inputmanager ..\ois\oisobject

IF "%1"=="-release" GOTO RELEASE

ECHO Creating the initial wrapper Dogre.lib....
implib /s bin\Debug\Dogre.lib bin\Debug\Dogre.dll
ECHO Compiling and consolidating Dogre...

FOR %%m IN (%modules%) DO dmd -c import\dogre\%%m.d -oflib\%%m.obj
FOR %%m IN (%modules%) DO lib bin\Debug\Dogre.lib lib\%%m.obj
FOR %%m IN (%modules%) DO DEL lib\%%m.obj

COPY bin\Debug\Dogre.lib lib\Dogre.lib
DEL bin\Debug\Dogre.lib
IF EXIST bin\Debug\Dogre.bak DEL bin\Debug\Dogre.bak
GOTO END


:RELEASE
ECHO Release Build!

ECHO Creating the initial wrapper Dogre.lib....
implib /s bin\Release\Dogre.lib bin\Release\Dogre.dll
ECHO Compiling and consolidating Dogre...

FOR %%m IN (%modules%) DO dmd -c -release import\dogre\%%m.d -oflib\%%m.obj
FOR %%m IN (%modules%) DO lib bin\Release\Dogre.lib lib\%%m.obj
FOR %%m IN (%modules%) DO DEL lib\%%m.obj

COPY bin\Release\Dogre.lib lib\Dogre.lib
DEL bin\Release\Dogre.lib
IF EXIST bin\Release\Dogre.bak DEL bin\Release\Dogre.bak
GOTO END


:END
